/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gui;

import java.util.List;

import javax.swing.JButton;

import com.beans.Conges;
import com.metier.CongesMetier;

/**
 *
 * @author massaer
 */
public class PanelConges extends javax.swing.JPanel {

    /**
     * Creates new form PanelConges
     */
    public PanelConges() {
        //initComponents();
    }
    public PanelConges(JButton b1, JButton b2) {
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    public void initComponents() {

        jScrollBar1 = new javax.swing.JScrollBar();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableConge = new javax.swing.JTable();

        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 0, 0)));
        setMaximumSize(new java.awt.Dimension(1050, 440));
        setMinimumSize(new java.awt.Dimension(1050, 440));
        setPreferredSize(new java.awt.Dimension(1050, 440));
        
        CongesMetier congesMetier= new CongesMetier();
        List<Conges> mesConges=congesMetier.mesConges(this.getUsrId());
        int nombreLigne = mesConges.size();
 		Object data[][] = new Object[nombreLigne][4];

 		for (int i = 0; i < nombreLigne; i++) {
 			Conges cng=mesConges.get(i);
 		data[i][0]= cng.getCngDateDebut();
 		data[i][1]= cng.getCngDateFin();
 		data[i][2]= cng.getCngEtat();
 		data[i][3]= cng.getCngNbreJr();
 		}

        tableConge.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        tableConge.setModel(new javax.swing.table.DefaultTableModel(data,
            new String [] {
                "Date début", "Date fin", "Motif", "Nombre de jours restants"
            }
        ));
        jScrollPane1.setViewportView(tableConge);


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1050, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 374, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
    }// </editor-fold>                        
    // Variables declaration - do not modify                     
    private javax.swing.JScrollBar jScrollBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tableConge;
    private long usrId;
    // End of variables declaration//GEN-END:variables
	public long getUsrId() {
		return usrId;
	}
	public void setUsrId(long usrId) {
		this.usrId = usrId;
	}
	public javax.swing.JScrollBar getjScrollBar1() {
		return jScrollBar1;
	}

	public void setjScrollBar1(javax.swing.JScrollBar jScrollBar1) {
		this.jScrollBar1 = jScrollBar1;
	}

	public javax.swing.JScrollPane getjScrollPane1() {
		return jScrollPane1;
	}

	public void setjScrollPane1(javax.swing.JScrollPane jScrollPane1) {
		this.jScrollPane1 = jScrollPane1;
	}

	public javax.swing.JTable getTableConge() {
		return tableConge;
	}

	public void setTableConge(javax.swing.JTable tableConge) {
		this.tableConge = tableConge;
	}
    
}
